package com.baidu.springcloud.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author ShiLei
 * @version v1.0
 * @date 2020-03-11 10:16
 * <p>
 * 统一返回结果类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CommonResult<T> {

    /**
     * 成功与否code
     */
    private Integer code;

    /**
     * 返回成功与否字符
     */
    private String message;

    /**
     * 返回具体的数据
     */
    private T data;

    public CommonResult(Integer code, String message) {
        this(code, message, null);
    }

    public CommonResult(T data) {
        this.data = data;
    }
}
